package com.study.sbsummary.model;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: biturd
 * @date: 2022/3/25 20:46
 * @description:
 */
// searchUserDocsBatch?userIdList=1202712959,878&pageSize=3
@Data
public class SearchUserDocsDTO {

    @NotNull(message = "userIdList")
    private List<Long> userIdList;

    private int pageSize = 3;

    public void setFriendIdList(String userIdList) {
        if (StringUtils.isBlank(userIdList)) {
            this.userIdList = null;
            return;
        }
        this.userIdList = Arrays.stream(userIdList.split(",")).map(v -> Long.parseLong(v)).collect(Collectors.toList());
    }
}
